﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;

/// <summary>
/// Summary description for BLLSanPham
/// </summary>
public class BLLSanPham
{
    public ISanPham iSanPham;
    public IDanhMuc iDanhMuc;
    public IHoaDon iHoaDon;
    public IThanhVien iThanhVien;
	public BLLSanPham()
	{
        iSanPham = new DALSanPham();
        iDanhMuc = new DALDanhMuc();
        iHoaDon = new DALHoaDon();
        iThanhVien = new DALThanhVien();
	}

    public  int insertHoaDon(DateTime ngayDatHang, DateTime ngayGiaoHang, string nguoiNhan, string diaChi, string email)
    {      
        HoaDon dtoHoaDon = new HoaDon();
        ThanhVien dtoThanhVien = new ThanhVien();
             
        dtoHoaDon.DiaChi = diaChi;
        dtoHoaDon.NgayDatHang = ngayDatHang;
        dtoHoaDon.NgayGiaoHang =ngayGiaoHang;
        dtoHoaDon.TenNguoiNhan =nguoiNhan;
        dtoHoaDon.DtoThanhVien = iThanhVien.SelectByEmail(email);

       return iHoaDon.insertHD(dtoHoaDon);
    }

    public DataTable getSPbyMaDM(string MaDM)
    {
        return iSanPham.selectSPbyDanhMuc(MaDM);
    }
}